1 /*
2 * Copyright (C) 2010 The Guava Authors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package com.google.common.collect;
18
19 import com.google.common.annotations.GwtCompatible;
20
21 import java.util.List;
22
23 import javax.annotation.Nullable;
24
25 /**
26 * A list multimap which forwards all its method calls to another list multimap.
27 * Subclasses should override one or more methods to modify the behavior of
28 * the backing multimap as desired per the <a
29 * href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>.
30 *
31 * @author Kurt Alfred Kluever
32 * @since 3.0
33 */
34 @GwtCompatible
35 public abstract class ForwardingListMultimap<K, V>
36 extends ForwardingMultimap<K, V> implements ListMultimap<K, V> {
37
38 /** Constructor for use by subclasses. */
39 protected ForwardingListMultimap() {}
40
41 @Override protected abstract ListMultimap<K, V> delegate();
42
43 @Override public List<V> get(@Nullable K key) {
44 return delegate().get(key);
45 }
46
47 @Override public List<V> removeAll(@Nullable Object key) {
48 return delegate().removeAll(key);
49 }
50
51 @Override public List<V> replaceValues(K key, Iterable<? extends V> values) {
52 return delegate().replaceValues(key, values);
53 }
54 }